<template>
  <div class="dashboard-container">

    <panel-group @handleSetLineChartData="handleSetLineChartData" />

    <el-card class="box-card body-card">
      <CateGory class="asd" />
    </el-card>

    <el-card>
      <el-row>
        <el-col :span="12">
          <template>
            <el-tabs type="border-card" style="width:90%" @tab-click="handleClick">
              <el-tab-pane>
                <span slot="label"><i class="el-icon-date" /> 房产管理</span>
                <div v-for="item in propertyList" :key="item.id" class="titil-groud">
                  <h3 class="h">-🏠 {{ item.title }}</h3>
                  <span> {{ item.desc }}</span>
                </div>
              </el-tab-pane>
              <el-tab-pane label="配置管理" />
              <el-tab-pane label="角色管理">角色管理</el-tab-pane>
              <el-tab-pane label="定时任务补偿">定时任务补偿</el-tab-pane>
            </el-tabs>
          </template>
        </el-col>
        <el-col :span="12">
          <BottomEchare />
        </el-col>
      </el-row>

    </el-card>
  </div>
</template>

<script>
import { getPropertyList } from '@/api/property'
import { mapGetters } from 'vuex'
import PanelGroup from './components/PanelGroup'
import CateGory from './components/category'
import BottomEchare from './components/BottomEchare'

const lineChartData = {
  newVisitis: {
    expectedData: [100, 120, 161, 134, 105, 160, 165],
    actualData: [120, 82, 91, 154, 162, 140, 145]
  },
  messages: {
    expectedData: [200, 192, 120, 144, 160, 130, 140],
    actualData: [180, 160, 151, 106, 145, 150, 130]
  },
  purchases: {
    expectedData: [80, 100, 121, 104, 105, 90, 100],
    actualData: [120, 90, 100, 138, 142, 130, 130]
  },
  shoppings: {
    expectedData: [130, 140, 141, 142, 145, 150, 160],
    actualData: [120, 82, 91, 154, 162, 140, 130]
  }
}

export default {
  name: 'Dashboard',
  components: {
    PanelGroup,
    CateGory,
    BottomEchare
  },
  data() {
    return {
      lineChartData: lineChartData.newVisitis,
      propertyList: []
    }
  },
  computed: {
    ...mapGetters([
      'name'
    ])
  },
  async created() {
    this.propertyList = await getPropertyList({
      _limit: 9,
      _start: 0
    })
    console.log('测试', this.propertyList)
  },
  methods: {
    handleSetLineChartData(type) {
      this.$emit('handleSetLineChartData', type)
    },
    handleClick() {
      console.log(123)
    }

  }
}
</script>

<style lang="scss" scoped>
  .dashboard {
  &-container {
  margin: 30px;
  }
  &-text {
  font-size: 30px;
  line-height: 46px;
  }
  }
  .body-card{
  margin-bottom:32px
  }
  .asd{
  width: 100%;
  }
.el-tabs{
height: 500px;
}
  .titil-groud{
    .h{
      margin: 5px 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      color: grey;
    }
    span{
      text-indent: 3em;
      display: block;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      font-size: 12px;
      color: #666;
    }
  }

</style>
